﻿#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;
using namespace std;
int main()
{
    int rect_xy = 10;
    int ratio = 1;
    int start_x = 0;
    int start_y = 0;
    cout << "1 shape = 10px";
    cout << "\nEnter start X coord:";
    cin >> start_x;
    cout << "Enter start Y coord:";
    cin >> start_y;
    cout << "Enter zoom ratio:";
    cin >> ratio;
    rect_xy *= ratio;
    RenderWindow window(VideoMode(500, 500), "Shapes", Style::Default);
    window.setVerticalSyncEnabled(true);
    RectangleShape shape1(Vector2f(rect_xy, rect_xy));
    RectangleShape shape2(Vector2f(rect_xy, rect_xy));
    RectangleShape shape3(Vector2f(rect_xy, rect_xy));
    RectangleShape shape4(Vector2f(rect_xy, rect_xy));
    RectangleShape shape5(Vector2f(10, 10));
    shape1.setPosition(start_x, start_y);
    shape1.setFillColor(Color::Blue);
    shape2.setPosition(start_x, rect_xy + start_y);
    shape2.setFillColor(Color::Blue);
    shape3.setPosition(rect_xy + start_x, rect_xy + start_y);
    shape3.setFillColor(Color::Blue);
    shape4.setPosition(rect_xy + start_x, rect_xy*2+start_y);
    shape4.setFillColor(Color::Blue);
    shape5.setFillColor(Color::Black);
    shape5.setOutlineColor(Color::White);
    shape5.setOutlineThickness(1);
    shape5.setPosition(0, 0);
    if (rect_xy * 3 + start_x >= 500 || rect_xy * 2 + start_y >= 500) {
        cout << "The size of the shape exceeds the size of the field. Exiting...";
        return 1;
    }
    while (window.isOpen())
    {
        Event event;
        while (window.pollEvent(event))
        {
            if (event.type == Event::Closed)
                window.close();
        }
        window.clear(Color::Black);
        for (int x = 0; x <= 500; x += 10) {
            for (int y = 0; y <= 500; y+=10) {
                shape5.setPosition(x, y);
                window.draw(shape5);
            }
        }
        
        window.draw(shape1);
        window.draw(shape2);
        window.draw(shape3);
        window.draw(shape4);
        window.display();
    }
    return 0;
}